import Vue from 'vue'
import App from './App'
import validCode from './components/validCode/validCode' // 支付密码组件

Vue.component('validcode', validCode)
import {
    myRequest,
    BASE_URL,
    IMG_URL
} from './common/http.js'

import store from './store'
//把vuex定义成全局组件
Vue.prototype.$store = store
Vue.prototype.$myRequest = myRequest
Vue.prototype.$BASE_URL = BASE_URL
Vue.prototype.$IMG_URL = IMG_URL
Vue.prototype.$process = "development" // development:开发环境  production：生产环境 （打包正式环境需要替换为'production'）
Vue.config.productionTip = false

App.mpType = 'app'

// 定义全局过滤器
Vue.filter("formatDate", (value, spe = '-') => {
    value = value * 1000
    let data = new Date(value);
    let year = data.getFullYear();
    let month = data.getMonth() + 1;
    let day = data.getDate();
    let h = data.getHours();
    let mm = data.getMinutes();
    let s = data.getSeconds();
    month = month >= 10 ? month : "0" + month;
    day = day >= 10 ? day : "0" + day;
    h = h >= 10 ? h : "0" + h;
    mm = mm >= 10 ? mm : "0" + mm;
    s = s >= 10 ? s : "0" + s;
    return `${year}${spe}${month}${spe}${day} ${h}:${mm}:${s}`;
})




const app = new Vue({
    ...App,
    //挂载
    store

})
app.$mount()